package com.example.SpringBoot_demo.service.impl;

import com.example.SpringBoot_demo.bean.Notice;
import com.example.SpringBoot_demo.mapper.NoticeMapper;
import com.example.SpringBoot_demo.service.INoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;
import java.util.List;

/**
 * Creat by wsn on 2021/7/21 10:44
 */
@Service
public  class NoticeService implements INoticeService {
    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public List<Notice> GetAllnotice(int startRow,int pageSize){
        return noticeMapper.GetAllnotice(startRow,pageSize);
    }

    @Override
    public void noticeinsert(String adminid, String adminname, String noticecontents, Timestamp noticedate) {
        noticeMapper.noticeinsert(adminid,adminname,noticecontents,noticedate);
    }
//    @Override
//    public Notice noticeinsert(Notice notice){
//        return  noticeMapper.noticeinsert(notice);
//    }

    @Override
    public int delete(Integer noticeid){
        return noticeMapper.delete(noticeid);
    }

    @Override
    public void update(Notice notice){
        noticeMapper.update(notice);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public Notice findNoticeById(int noticeid){
        return noticeMapper.findNoticeById(noticeid);
    }

    @Override
    public void freshAllNoticeID1(Notice notice) {
        noticeMapper.freshAllNoticeID1(notice);
    }

    @Override
    public void freshAllNoticeID2(Notice notice) {
        noticeMapper.freshAllNoticeID2(notice);
    }

    @Override
    public int total(int pageSize) {
        return noticeMapper.total(pageSize);
    }


}
